package org.jeecg.modules.carRecord.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.carRecord.entity.CarRecord;

import java.util.List;
import java.util.Map;

/**
 * @Description: 车辆进出记录
 * @Author: jeecg-boot
 * @Date:   2024-07-24
 * @Version: V1.0
 */
public interface CarRecordMapper extends BaseMapper<CarRecord> {

    @Select("SELECT count(*) as count , DATE_FORMAT(create_time,'%Y-%m-%d') as time FROM car_record GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d')")
    List<Map<String, Object>> getCount();

    @Select("SELECT COUNT(*) AS today_count FROM car_record " +
            "WHERE create_time >= CURRENT_DATE AND create_time < CURRENT_DATE + INTERVAL 1 DAY;")
    int getTodayInCount();

}
